/******************************************************************
*
* Copyright 2010 Darshan M Sonde
*
* This file is part of ddots.
*
* ddots is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* ddots is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with ddots.  If not, see <http://www.gnu.org/licenses/>.
*
*********************************************************************/

#include "dialog.h"
#include <QDialog>
#include <QtGui>

Dialog::Dialog(QWidget *parent):QDialog(parent)
{
    ui.setupUi(this);
}

void Dialog::addEngine(QString name)
{
    QComboBox *player1List=findChild<QComboBox*>("player1List");
    QComboBox *player2List=findChild<QComboBox*>("player2List");

    if(player1List)
        player1List->addItem(name);
    if(player2List)
        player2List->addItem(name);
}

int Dialog::rows()
{
    QLineEdit *r=findChild<QLineEdit*>("rowsLine");
    if(r) return r->text().toInt(0,10);
    else return 0;
}

int Dialog::columns()
{
    QLineEdit *c=findChild<QLineEdit*>("columnsLine");
    if(c) return c->text().toInt(0,10);
    else return 0;
}

QString Dialog::playerOneChoice()
{
    QComboBox *player1List=findChild<QComboBox*>("player1List");
    if(player1List) {
        return player1List->currentText();
    }return QString();
}

QString Dialog::playerTwoChoice()
{
    QComboBox *player2List=findChild<QComboBox*>("player2List");
    if(player2List) {
        return player2List->currentText();
    }return QString();
}
